package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.EcologyHatchCollecionShareProfitConf;
import com.sc.nft.entity.vo.ecology.AdminEcologyIncomeConfVO;
import com.sc.nft.entity.vo.merchantPledgeTask.AdminEcologyIncomeConfListVO;
import com.sc.nft.entity.vo.merchantPledgeTask.NewAdminEcologyIncomeConfDetailsVO;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.EcologyHatchShareIncomeConf;
import com.sc.nft.mapper.EcologyHatchShareIncomeConfMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 生态藏品-直推收益配置(sc_ecology_hatch_share_income_conf)数据DAO
 *
 * @author Sun
 * @since 2023-12-02 16:37:49
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class EcologyHatchShareIncomeConfDao extends ServiceImpl<EcologyHatchShareIncomeConfMapper, EcologyHatchShareIncomeConf> {

    public List<EcologyHatchShareIncomeConf> getListByConfId(Long id) {
        LambdaQueryWrapper<EcologyHatchShareIncomeConf> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(EcologyHatchShareIncomeConf::getConfId,id);
        return list(wrapper);
    }

    public List<EcologyHatchShareIncomeConf> getListByConfIdAndCollectionId(Long confId,List<Long> collectionIds) {
        LambdaQueryWrapper<EcologyHatchShareIncomeConf> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(EcologyHatchShareIncomeConf::getCollectionId,collectionIds);
        wrapper.in(EcologyHatchShareIncomeConf::getConfId,confId);
        return list(wrapper);
    }

    public NewAdminEcologyIncomeConfDetailsVO getConfList(Long confId) {
        return baseMapper.getConfList(confId);
    }

    public List<Long> getCollectionIdsByConfId(Long confId) {
        return baseMapper.getCollectionIdsByConfId(confId);
    }

    public boolean removeByConfId(Long confId) {
        LambdaQueryWrapper<EcologyHatchShareIncomeConf> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(EcologyHatchShareIncomeConf::getConfId,confId);
        return remove(wrapper);
    }

    public int getCountByConfId(Long confId) {
        LambdaQueryWrapper<EcologyHatchShareIncomeConf> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(EcologyHatchShareIncomeConf::getConfId,confId);
        return count(wrapper);
    }

    public boolean delByConfId(Long confId) {
        return this.lambdaUpdate()
                .eq(EcologyHatchShareIncomeConf::getConfId, confId)
                .remove();
    }
}